var szCreatingDivs = new String();
var MaxShownCharacters = 40;

var wW = 400;
var wH = 205;

function resize2finalmess()
{
	top.setPnD(wW,wH);
}

function shine(elId,shineColor)
{
	document.all[elId].style.backgroundColor = shineColor;
}

function caseShine (bCase,elID,shineColor)
{
	if (bCase)
	{
		shine(elID,shineColor)
	}
}

function PB_Cursor(szCursor)
{
	//!... переделать в передачу состояний и их обработку
	document.all["scenario2"].style.cursor = szCursor;
}				


function ShowProgressBar()
{
	//HideAlertDiv();
	//HideAlert2Div();
	//HideSelects();
	document.all["scenario2"].style.visibility = "visible";
}


function HideAlert2Div()
{

	if (typeof document.all["alertdiv2"] != "undefined")
	{
		document.all["alertdiv2"].style.visibility = "hidden";
	}
	else
	{
		Err = createAlert2Div();
		document.all["alertdiv2"].style.visibility = "hidden";
	}
}

function HideAlertDiv()
{
	if (typeof document.all["alertdiv"] != "undefined")
	{
		document.all["alertdiv"].style.visibility = "hidden";
	}
	else
	{
		Err = createAlertDiv();
		document.all["alertdiv"].style.visibility = "hidden";
	}
}

function HideProgressBar()
{
	if (document.all["scenario2"] != "undefined")
	{
		document.all["scenario2"].style.visibility = "hidden";
	}
	else
	{
		Err = createProgressBar();
		document.all["scenario2"].style.visibility = "hidden";
	}
}


function caseCursor(bCase,elID,szCursor)
{
//if IE6
	if ((bCase) && (typeof document.all[elID] != "undefined"))
	{
		document.all[elID].style.cursor = szCursor;
	}
}

function focus_(eID)
{
	setTimeout("document.all['"+eID+"'].focus();",500);
}

function hideLangDiv()
{
	if (typeof document.all["scenario_langs"] != "undefined")
	{
		document.all["scenario_langs"].style.visibility = "hidden";
	}
	else
	{
		Err = createAppDiv();
		document.all["scenario_langs"].style.visibility = "hidden";
	}
}

function createAppDiv()
{
	szCreatingDivs = "<DIV onselect='return false;' id=scenario_l1 style='position:absolute; top:1px; left:323px; visibility:visible; width:60; height:16; border:0; scroll:none; cellpadding:0; cellspacing:0; margin:0;'><table height=16 border=0 cellpadding=1 cellspacing=0><tr height=16><td width=80 style='font-size:10pt;'>";
	szCreatingDivs += "<a onclick='document.all[\"scenario_langs\"].style.visibility=\"visible\"; window.event.cancelBubble=true;' title='" + top.messages["choose_lang"] + "' style='font-size:12px;font-weight:bold;color:#2C477F;'> [" + top.aLangs[top.sessVars["llanguage_selected"]] + "] </a></td></tr></table></DIV>";
	szCreatingDivs += "<DIV onselect='return false;' id=scenario3 style='position:absolute; top:1px; left:383px; visibility:visible; width:16; height:16; border:0; scroll:none; cellpadding:0; cellspacing:0; margin:0;'>";
	szCreatingDivs += " <img tabindex=7 src='../images/_close_1.gif' id='btn_hta_close' border=0 onFocus='fadeoff();' onClick='top.hta_close();' onDrag='return false;'></DIV>";
	szCreatingDivs += "<DIV id=scenario_langs align=center style='border:0; position:absolute; top:1; left:143; text-align:center; visibility:hidden; width=256; height=156; scroll:yes; overflow:scroll; cellpadding:2; cellspacing:0; margin:0;'>";
	szCreatingDivs += "<table border=0 bgcolor=#eeeeee style='border: #999999 1px dashed; ' cellspacing=1 cellpadding=4 width=100%>";
	szCreatingDivs += "<tr height=40><td width=40 align=center onClick='top.newlang(1)'><img src='../images/l_english.gif' id='l_01' border=1 hspace=3 style='border: 1px #333333 solid;' ";
	szCreatingDivs += " onClick='top.newlang(1);' alt='" + top.messages["english"] + "'  onDrag='return false;' ></td><td align=left onClick='top.newlang(1)'><b>" + top.messages["english"] + "</b></td>";
	szCreatingDivs += "<tr height=40><td width=40 align=center onClick='top.newlang(2)'><img src='../images/l_german.gif' id='l_01' border=1 hspace=3 style='border: 1px #333333 solid;' ";
	szCreatingDivs += " onClick='top.newlang(2);' alt='" + top.messages["german"] + "'  onDrag='return false;' ></td><td align=left onClick='top.newlang(2)'><b>" + top.messages["german"] + "</b></td>";
	szCreatingDivs += "<tr height=40><td width=40 align=center onClick='top.newlang(3)'><img src='../images/l_dutch.gif' id='l_01' border=1 hspace=3 style='border: 1px #333333 solid;' ";
	szCreatingDivs += " onClick='top.newlang(3);' alt='" + top.messages["dutch"] + "'  onDrag='return false;' ></td><td align=left onClick='top.newlang(3)'><b>" + top.messages["dutch"] + "</b></td>";
	szCreatingDivs += "<tr height=40><td width=40 align=center onClick='top.newlang(4)'><img src='../images/l_french.gif' id='l_01' border=1 hspace=3 style='border: 1px #333333 solid;' ";
	szCreatingDivs += " onClick='top.newlang(4);' alt='" + top.messages["french"] + "'  onDrag='return false;' ></td><td align=left onClick='top.newlang(4)'><b>" + top.messages["french"] + "</b></td>";
	szCreatingDivs += "<tr height=40><td width=40 align=center onClick='top.newlang(5)'><img src='../images/l_italian.gif' id='l_01' border=1 hspace=3 style='border: 1px #333333 solid;' ";
	szCreatingDivs += " onClick='top.newlang(5);' alt='" + top.messages["italian"] + "'  onDrag='return false;' ></td><td align=left onClick='top.newlang(5)'><b>" + top.messages["italian"] + "</b></td>";
	szCreatingDivs += "<tr height=40><td width=40 align=center onClick='top.newlang(6)'><img src='../images/l_spanish.gif' id='l_01' border=1 hspace=3 style='border: 1px #333333 solid;' ";
	szCreatingDivs += " onClick='top.newlang(6);' alt='" + top.messages["spanish"] + "'  onDrag='return false;' ></td><td align=left onClick='top.newlang(6)'><b>" + top.messages["spanish"] + "</b></td>";
	szCreatingDivs += "<tr height=40><td width=40 align=center onClick='top.newlang(7)'><img src='../images/l_russian.gif' id='l_01' border=1 hspace=3 style='border: 1px #333333 solid;' ";
	szCreatingDivs += " onClick='top.newlang(7);' alt='" + top.messages["russian"] + "'  onDrag='return false;' ></td><td align=left onClick='top.newlang(7)'><b>" + top.messages["russian"] + "</b></td>";
	szCreatingDivs += "</table></DIV>";

	document.body.innerHTML = document.body.innerHTML + szCreatingDivs;
	document.all["btn_hta_close"].alt = top.messages["btn_hta_close_can_close"];
}

function placeProgressBar()
{
	if (typeof document.all["scenario2"] == "undefined")
	{
	}
	
	document.all["scenario2"].style.top = 1;
}

function createProgressBar()
{
	szCreatingDivs = "<DIV id='scenario2' onselect='return false;' align=center style='cursor:default; border:0; position:absolute; top:1; left:143; visibility:hidden; width=256; height=156; text-align:center; scroll:yes; cellpadding:2; cellspacing:0; margin:0;'>";
	szCreatingDivs += "<table border=0 bgcolor='#eeeeee' style='border: #999999 1px dashed; ' cellspacing=2 cellpadding=0 height=156 width=256>";
	szCreatingDivs += "<tr height=32><td width=256 align=center id=installation_state colspan=2 style='text-decoration:underline;' class=info_txt></td></tr>";
	szCreatingDivs += "<tr height=1><td width=48 align=center><img src='../images/t1x1.gif' height=1 width=48 border=0></td>";
	szCreatingDivs += "<td width=202 align=right><img src='../images/t1x1.gif' height=1 width=202 border=0></td></tr>";
	szCreatingDivs += "<tr height=14><td width=48 align=center id=progress_bar_value class=info_txt style='font-size:10px;'></td>";
	szCreatingDivs += "<td id=progress_1 width=202 align=left bgcolor='#c2c2c2'><img id=progress_bar_img2 src='../images/progress_2.gif' border=1 style='border: 1px solid #000000;' ondrag='return false;' width=0 height=14></td></tr>";
	szCreatingDivs += "<tr height=14><td width=256 align=left colspan=2><p id=src_bar_value class=info_txt></td></tr>";
	szCreatingDivs += "<tr height=14><td width=256 align=left colspan=2 class=info_txt id=dest_bar_value class=info_txt></td></tr>";
	szCreatingDivs += "<tr id=progress_2 height=14><td width=50 align=center id=allprogress_bar_value class=info_txt style='font-size:10px;'></td>";
	szCreatingDivs += "<td width=202 align=left bgcolor='#c2c2c2'><img id=allprogress_bar_img2 src='../images/progress_2.gif' border=1 style='border: 1px solid #000000;' ondrag='return false;' width=0 height=14></td></tr>";
	szCreatingDivs += "<tr height=14><td width=256 align=right colspan=2><input id='progressbar_btn' type=button value='" + top.messages["Cancel"] + "' class=alert_btn onclick=' '></td></tr>";
	szCreatingDivs += "</table></DIV>";

	document.body.innerHTML = document.body.innerHTML + szCreatingDivs;

}

function lightoff_()
{
	//document.all["td1"].mouseout();
}

function createAlertDiv()
{
//	szCreatingDivs = "<DIV id=alertdiv align=center style='border:0; position:absolute; top:1; left:143; text-align:center; visibility:hidden; width=256; height=156; scroll:yes; cellpadding:2; cellspacing:0; margin:0;'>";
//	szCreatingDivs += "<table border=0 bgcolor=#eeeeee style='border: #999999 1px dashed; ' cellspacing=1 cellpadding=4 width=256 height=158>";
//	szCreatingDivs += "<tr><td width=256 align=center><p id=alertdiv_mess class=info_txt><b></b></p></td></tr>";
//	szCreatingDivs += "<tr><td width=256 align=center><input id=alertdiv_btn type=button class='alert_btn' value=''></td></tr>";
//	szCreatingDivs += "</table></DIV>";
//	document.body.innerHTML = document.body.innerHTML + szCreatingDivs;
}

function createAlert2Div()
{
//	szCreatingDivs = "<DIV id=alertdiv2 align=center style='border:0; position:absolute; top:1; left:143; text-align:center; visibility:hidden; width=256; height=156; scroll:yes; cellpadding:2; cellspacing:0; margin:0;'>";
//	szCreatingDivs += "<table border=0 bgcolor=#eeeeee style='border: #999999 1px dashed; ' cellspacing=1 cellpadding=4 width=256 height=158>";
//	szCreatingDivs += "<tr><td width=256 align=center colspan=2><p id=alertdiv2_mess class=info_txt></p></td></tr>";
//	szCreatingDivs += "<tr><td width=256 align=center><input id=alertdiv2_btn1 type=button value=' ' class='alert_btn'></td>";
//	szCreatingDivs += "<td width=256 align=center><input id=alertdiv2_btn2 type=button value=' ' class='alert_btn'></td></tr></table></DIV>";
//	document.body.innerHTML = document.body.innerHTML + szCreatingDivs;
}

function createAlert2Div_() {}

function document_onkeydown() {}

function showmanual() {}

function goInstallFiles() {}

function goInstallFiles2() {}

function goUpdate() {}

function HideDivs() {}

function ShowAlertDiv(szMess,szRun, szTtl)
{
	top.HideSelects();
	//top.HideScenarioButtons();
	top.szContinueWith = szRun;	
	document.all["alertdiv_mess"].innerText = szMess;
	document.all["alertdiv_btn"].value=szTtl;
	document.all["alertdiv_btn"].onclick=top.setTimeout_;
	document.all["alertdiv"].style.visibility = "visible";
}

function ShowAlert2Div(szMess,szRun1,szRun2,szTtl1,szTtl2)
{
	top.HideSelects();
	//HideScenarioButtons();
	document.all["alertdiv2_mess"].innerText = szMess;
	top.szContinueWith1 = szRun1;
	top.szContinueWith2 = szRun2;
	document.all["alertdiv2_btn1"].onclick=top.setTimeout_1;
	document.all["alertdiv2_btn2"].onclick=top.setTimeout_2;
	document.all["alertdiv2_btn1"].value=szTtl1;
	document.all["alertdiv2_btn2"].value=szTtl2;
	document.all["alertdiv2"].style.visibility = "visible";
}

function PB_Action(szAction)
{
	if (typeof document.all["scenario2"] != "undefined")
	{
		document.all["progressbar_btn"].onclick = szAction;
	}
	else
	{
		createProgressBar();
		document.all["progressbar_btn"].onclick = szAction;
	}
}

function PB_BtnLabel(szLabel)
{
	if (typeof document.all["scenario2"] != "undefined")
	{
		document.all["progressbar_btn"].value = szLabel;
	}
	else
	{
		createProgressBar();
		document.all["progressbar_btn"].value = szLabel;
	}
}

function PB_State(propState,szStateText)
{
	if (typeof document.all["scenario2"] == "undefined")
	{
		createProgressBar();
	}
	
	if ((propState == "src") || (propState == "dest") || (propState == "state"))
	{
		if (propState == "src")
		{
			//document.all["src_bar_value"].title = szStateText;
			document.all["progress_1"].title = szStateText;
			//document.all["src_bar_value"].innerText = top.prepareShortedString(szStateText, MaxShownCharacters);
		}
		if (propState == "dest")
		{
			document.all["dest_bar_value"].title = szStateText;
			document.all["progress_2"].title = szStateText;
			document.all["dest_bar_value"].innerText = top.prepareShortedString(szStateText, MaxShownCharacters);
		}
		if (propState == "state")
		{
			document.all["installation_state"].innerText = szStateText;
		}
	}
}

function PB_All(iPercentage)
{
	if (typeof document.all["scenario2"] == "undefined")
	{
		createProgressBar();
	}
	document.all["allprogress_bar_value"].innerText = iPercentage + "%";
	//document.all["allprogress_bar_img1"].style.width = 2 * ( 100 - iPercentage ); 
	document.all["allprogress_bar_img2"].style.width = 2 * iPercentage;
}

function PB_Qvant(iPercentage)
{
	if (typeof document.all["progress_bar_value"] != "undefined")
	{
		document.all["progress_bar_value"].innerText = iPercentage + "%";
	}
	if (typeof document.all["progress_bar_img2"] != "undefined")
	{
		//document.all["progress_bar_img1"].style.width = 2 * ( 100 - iPercentage );
		document.all["progress_bar_img2"].style.width = 2 * iPercentage;
	} 
}